package com.woniuxy.light_smart.service.imp;

import com.woniuxy.light_smart.dto.LightPoleDto;
import com.woniuxy.light_smart.entity.LightPole;
import com.woniuxy.light_smart.mapper.FacilityMapper;
import com.woniuxy.light_smart.mapper.LightPoleMapper;
import com.woniuxy.light_smart.service.FacilityService;
import com.woniuxy.light_smart.service.LightPoleService;
import com.woniuxy.light_smart.vo.LightPoleVo;
import com.woniuxy.light_smart.vo.PointVo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;

import javax.annotation.Resource;
import java.util.List;

@Service
public class LightPoleServiceImpl implements LightPoleService {
    @Resource
    private LightPoleMapper lightPoleMapper;
    @Resource
    private FacilityMapper facilityMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return lightPoleMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insertSelective(LightPole record) {
        return lightPoleMapper.insertSelective(record);
    }

    @Override
    public LightPole selectByPrimaryKey(Long id) {
        return lightPoleMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(LightPole record) {
        return lightPoleMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    @Transactional
    public void del(String id) {
        lightPoleMapper.del(id);
        facilityMapper.delByLight(id);
    }

    @Override
    public List<LightPoleVo> selByNameAndArea(LightPoleDto lightPoleDto) {
        List<LightPoleVo> lightPoleVos = lightPoleMapper.selByNameAndArea(lightPoleDto);
        return lightPoleVos;
    }

    @Override

    public List<LightPole> sele() {
        return lightPoleMapper.sele();
    }
    public List<LightPoleVo> selXy() {
        return lightPoleMapper.selXy();
    }
}
